<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SwiftUI 100天 - A5图书封面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #2c3e50, #1a2530);
            color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            padding: 20px;
        }

        /* A5尺寸容器 */
        .a5-page {
            width: 148mm;
            height: 210mm;
            background: linear-gradient(rgba(28, 28, 30, 0.85), rgba(28, 28, 30, 0.85));
            background-size: cover;
            background-position: center;
            position: relative;
            overflow: hidden;
            color: white;
            /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); */
            border: 1px solid #444;
        }

        .page-content {
            padding: 15mm;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            position: relative;
            z-index: 2;
        }

        /* 装饰元素 */
        .decoration {
            position: absolute;
            z-index: 1;
        }

        .circle {
            border-radius: 50%;
            background: rgba(177, 35, 34, 0.15);
        }

        .circle-1 {
            width: 60mm;
            height: 60mm;
            top: -30mm;
            left: -30mm;
        }

        .circle-2 {
            width: 40mm;
            height: 40mm;
            bottom: 15mm;
            right: -20mm;
        }

        .circle-3 {
            width: 30mm;
            height: 30mm;
            top: 25mm;
            right: 20mm;
        }

        /* 品牌头部区域 */
        .brand-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 8mm;
        }

        .brand-info {
            display: flex;
            align-items: center;
            gap: 3mm;
        }

        .brand-logo {
            width: 15mm;
            height: 15mm;
            background: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            color: #1a365d;
        }

        .brand-name {
            font-size: 4mm;
            font-weight: 700;
            letter-spacing: 0.5px;
            color: #FFFFFF;
            text-transform: uppercase;
        }

        /* 标题区域 */
        .title-container {
            text-align: center;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .main-title {
            font-size: 16mm;
            font-weight: 900;
            letter-spacing: -0.8px;
            line-height: 1;
            margin-bottom: 6mm;
            color: white;
        }

        .accent {
            color: #B12322;
        }

        .subtitle {
            font-size: 6mm;
            font-weight: 500;
            letter-spacing: 0.4px;
            margin-bottom: 6mm;
            color: #FFFFFF;
        }

        .days-badge {
            background-color: #B12322;
            padding: 2mm 6mm;
            border-radius: 25px;
            font-weight: 700;
            font-size: 5mm;
            display: inline-block;
            margin-top: 4mm;
            color: white;
            white-space: nowrap;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
        }

        /* 代码预览 */
        .code-preview {
            width: 60mm;
            background: rgba(28, 28, 30, 0.9);
            border-radius: 2.5mm;
            padding: 4mm;
            font-family: 'Menlo', 'Monaco', monospace;
            font-size: 2.8mm;
            line-height: 1.5;
            border: 1px solid rgba(177, 35, 34, 0.4);
            margin: 6mm auto;
        }

        .code-line {
            color: #78C2FF;
        }

        .code-comment {
            color: #8E8E93;
        }

        .code-keyword {
            color: #FF7AB2;
        }

        /* 底部区域 */
        .footer {
            text-align: center;
            margin-top: auto;
            padding-bottom: 4mm;
        }

        .author {
            font-size: 4mm;
            font-weight: 500;
            color: white;
        }

        .author-name {
            color: #B12322;
            font-weight: 700;
        }

        /* 打印按钮 */
        .print-button {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: #B12322;
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 6px;
            font-weight: 600;
            cursor: pointer;
            z-index: 1000;
        }

        .print-button:hover {
            background: #9a1c1b;
        }

        /* 打印设置 */
        @page {
            size: A5;
            margin: 0;
        }

        @media print {
            body {
                background: none;
                display: block;
                padding: 0;
            }

            .a5-page {
                width: 148mm;
                height: 210mm;
                margin: 0;
                box-shadow: none;
                border: none;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .print-button {
                display: none;
            }
        }
    </style>
</head>

<body>
    <div class="a5-page">
        <!-- 装饰元素 -->
        <div class="decoration circle circle-1"></div>
        <div class="decoration circle circle-2"></div>
        <div class="decoration circle circle-3"></div>

        <div class="page-content">
            <!-- 品牌头部区域 -->
            <div class="brand-header">
                <div class="brand-info">
                    <div class="brand-logo">Swift</div>
                    <div class="brand-name">Hacking with Swift</div>
                </div>
            </div>

            <!-- 标题区域 -->
            <div class="title-container">
                <h1 class="main-title">SwiftUI <span class="accent">100天</span></h1>
                <p class="subtitle">掌握iOS应用开发的终极指南</p>
                <div class="days-badge">100 DAYS OF SWIFTUI - 中文版</div>
            </div>

            <!-- 代码预览 -->
            <div class="code-preview">
                <div class="code-line"><span class="code-keyword">import</span> SwiftUI</div>
                <div class="code-line"></div>
                <div class="code-line"><span class="code-keyword">struct</span> <span
                        class="code-comment">WelcomeView</span>: View {</div>
                <div class="code-line">&nbsp;&nbsp;<span class="code-keyword">var</span> body: <span
                        class="code-keyword">some</span> View {</div>
                <div class="code-line">&nbsp;&nbsp;&nbsp;&nbsp;VStack {</div>
                <div class="code-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Text(<span class="code-comment">"Hello,
                        SwiftUI!"</span>)</div>
                <div class="code-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.font(.largeTitle)</div>
                <div class="code-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.foregroundColor(.red)</div>
                <div class="code-line">&nbsp;&nbsp;&nbsp;&nbsp;}</div>
                <div class="code-line">&nbsp;&nbsp;}</div>
                <div class="code-line">}</div>
            </div>

            <!-- 底部区域 -->
            <div class="footer">
                <div class="author">由 <span class="author-name">SwiftUI训练营</span> 翻译整理</div>
            </div>
        </div>
    </div>

    <button class="print-button" onclick="window.print()">导出PDF</button>
</body>

</html>